package com.example.security.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.security.Principal;

@Controller
public class IndexController {

  @GetMapping("/")
  @ResponseBody
  String showIndex(Principal principal) {
    return String.format("Hello, user %s!", principal.getName());
  }
}
